<%--
  Created by IntelliJ IDEA.
  User: chinalin
  Date: 2017/3/16
  Time: 12:27
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    pageContext.setAttribute("BASE",path);
%>
<head>
    <title>jQuery Form插件例子-ajaxForm()</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <script src="${BASE}/asset/lib/jquery/jquery-3.1.1.min.js" type="text/javascript"></script>
    <script src="${BASE}/asset/lib/jquery-form/jquery.form.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function() {
            $('#myForm').ajaxForm({
                type:'post',
                url:'${BASE}/demo.jsp',
                success: function() {
                    $('#output1').html("提交成功！欢迎下次再来！").show();
                    location.href = '${BASE}/a.jsp' ;
                }
            });
        });
    </script>
</head>
<body>
<h3> Demo 1 : form插件的使用--ajaxForm().
    基本路径:${BASE}
</h3>
<%--<form id="myForm" action="demo.jsp" method="post">--%>
<form id="myForm" >
    名称： <input type="text" name="name" /> <br/>
    地址： <input type="text" name="address" /><br/>
    自我介绍： <textarea name="comment"></textarea> <br/>
    <input type="submit" id="test" value="提交" /> <br/>
    <div id="output1" style="display:none;"></div>
</form>
</body>
</html>


